from db import utils
from logger import logger
from sub_events.base_event import BaseEvent

LOGGER = logger.CustomLogger()

class ForceTddEvent(BaseEvent):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.event_name_zh: str = "TDD检查强制通过"
        self.event_name_en: str = "Force TDD Check"

    def pre_execute(self) -> bool:
        return (self.hook.commenter in self.cfg.get("sub_events", {}).get("check_tdd", {}).get("force_accounts")
                or self.hook.commenter in self.cfg.get("accounts", {}).get("notifier"))

    def execute(self) :
        utils.update_event_force_pass(self.hook, "tdd", self.hook.commenter)
        self.comment = """TDD检查已强制通过，可继续联系审查人进行加分。
TDD check has been forcibly passed, and you may contrack the reviewers to review."""
